import { nativeTheme } from 'electron'
import { is } from '@electron-toolkit/utils'
import path from 'path'

export const getWindowURL = (pathName) => {
    if (is.dev && process.env['ELECTRON_RENDERER_URL']) {
        return `${process.env['ELECTRON_RENDERER_URL']}/#/${pathName}`
    } else {
        return `file://${path.join(__dirname, '../renderer/index.html')}#/${pathName}`
    }
}

export const getBaseWindowOptions = () =>
    Object({
        backgroundColor: nativeTheme.shouldUseDarkColors ? '#1a1a1a' : '#f5f5f5',
        icon: path.join(__dirname, '../../resources/icon.png'),
        frame: false,
        show: false,
        webPreferences: {
            preload: path.join(__dirname, '../preload/index.js')
        }
    })
